home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c / 169 < prev    next >
Internet Message Format  |  1996-08-06  |  3KB

  1. Path: lyra.csx.cam.ac.uk!nmm1
  2. From: nmm1@cus.cam.ac.uk (Nick Maclaren)
  3. Newsgroups: comp.std.c
  4. Subject: Re: The temporal scope of undefined behaviour [was Re: atexit() ...]
  5. Date: 23 Jan 1996 18:23:17 GMT
  6. Organization: University of Cambridge, England
  7. Message-ID: <4e392l$f1v@lyra.csx.cam.ac.uk>
  8. References: <4dhfja$j50@fg70.rz.uni-karlsruhe.de> <DLMLL6.A0H@ukpsshp1.serigate.philips.nl> <4e2eo4$ogq@lyra.csx.cam.ac.uk> <TANMOY.96Jan23090015@qcd.lanl.gov>
  9. NNTP-Posting-Host: bootes.cus.cam.ac.uk
  10.  
  11. In article <TANMOY.96Jan23090015@qcd.lanl.gov>,
  12. Tanmoy Bhattacharya <tanmoy@qcd.lanl.gov> wrote:
  13. >--text follows this line--
  14. >In article <4e2eo4$ogq@lyra.csx.cam.ac.uk> nmm1@cus.cam.ac.uk (Nick
  15. >Maclaren) writes: 
  16. ><snip>
  17. >   This is a very good question.  I understand the standard to imply
  18. >   that all previous defined behaviour must have 'occurred', but
  19. >   there is (in general) no necessity for it to have had an effect
  20. >   on the outside world (assuming that such a thing exists).  Some
  21. >   constructions (e.g. fflush()) require effects to be transmitted
  22. >   to the environment.
  23. >
  24. >Could you please elaborate on this? 3.16 seems to be saying that the
  25. >behaviour of the program is undefined. It refers to both translation
  26. >and execution phases, and even allows the translation to terminate: in
  27. >which case there is no execution at all! I think a compiler core
  28. >dumping is as conforming a response as the program starting with the
  29. >program starting with an attempted execution of Bach, presumably
  30. >because the compiler ignored the possibility and that led to a bizarre
  31. >executable. 
  32. >
  33. >So, I do not understand how you can demand `previous' defined
  34. >behaviour to have occurred? Previous to what? Previous to the
  35. >attempted translation of the construct leading to undefined behavior? 
  36.  
  37. No, of course not.  The majority of circumstances that lead to undefined
  38. behaviour are inherently associated with execution - i.e. whether the
  39. program is conformant or not will depend upon the data, and cannot be
  40. determined during translation.  You are correct that the standard's
  41. wording allows a translator to detect undefined behaviour and, having
  42. done this, to go bananas rather than actually diagnosing the fault.
  43. But that is gratuitously perverse.
  44.  
  45. As you know, there IS an inherent order implied during execution
  46. (though it is mathematically pretty horrible, being a set of vaguely
  47. compatible partial orders).  I am referring to the case where the
  48. undefined behaviour is either not determinable or not detected during
  49. translation, and hence the execution chronology becomes relevant.
  50. In general, this is the interesting and practical case.
  51.  
  52.  
  53. Nick Maclaren,
  54. University of Cambridge Computer Laboratory,
  55. New Museums Site, Pembroke Street, Cambridge CB2 3QG, England.
  56. Email:  nmm1@cam.ac.uk
  57. Tel.:  +44 1223 334761    Fax:  +44 1223 334679
  58.